package com.axjy.controller;

import com.axjy.pojo.Role;
import com.axjy.pojo.User;
import com.axjy.service.RoleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dell on 2017/10/30.
 */
@RestController
@RequestMapping("/sys/role")
public class RoleController {

    @Resource
    private RoleService roleService;

    @RequestMapping("list")
    public List<Role> list(){
        List<Role> list = roleService.list();
        return list;
    }

    @RequestMapping("searchByRole")
    public List<User> searchById(Integer roleId){
        return  roleService.getUserById(roleId);
    }

}
